import request from '@/utils/request';

// 用户密码登录
export const login = (data: { username: string; password: string }) => {
  return request({
    url: '/auth/login',
    method: 'post',
    data,
  });
}
// 获取验证码
export const getCode = (email: { email: string }) => {
  return request({
    url: '/api/sendEmailCode',
    method: 'get',
    params: email,
  });
}
// 注册
export const register = (data: { username: string; password: string; email: string; code: string }) => {
  return request({
    url: '/api/email/register',
    method: 'post',
    data,
  });
}
// 找回密码
export const resetPassword = (data: { username: string; password: string; email: string; code: string }) => {
  return request({
    url: '/api/email/forgot',
    method: 'post',
    data,
  });
}